package dbmig.util;


import org.jetbrains.annotations.NotNull;



/**
 * Static string functions.
 */
public abstract class Strings
{

    @NotNull
    public static String capitalize(final @NotNull String str)
    {
        int n = str.length();
        if (n == 0)
            return "";

        StringBuilder b = new StringBuilder(n);
        char cx = str.charAt(0);
        b.append(Character.toUpperCase(cx));
        for (int i = 1; i < n; i++)
        {
            char c = str.charAt(i);
            c = (cx == '_') ? Character.toUpperCase(c) : Character.toLowerCase(c);
            b.append(c);
            cx = c;
        }

        return b.toString();
    }


}
